﻿package mortal.game.view.levelReward
{
    import __AS3__.vec.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.component.window.resWin.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.levelReward.panel.*;
    import mortal.game.view.wizard.*;
    import mortal.mvc.interfaces.*;

    public class LevelRewardModule extends ResBaseWindow
    {
        private var currentIndex:int = -1;
        private var curPanel:ResBasePanel = null;
        private var tabBar:GTabarNew = null;
        private var tabData:Array = null;
        private var panelClassList:Vector.<Class>;
        public static var allowShow:Boolean = false;

        public function LevelRewardModule(param1:ILayer = null)
        {
            this.panelClassList = new Vector.<Class>;
            super(param1, ResFileConst.levelReward);
            setSize(898, 598);
            this.title = Language.getString(41269);
            return;
        }// end function

        override public function layoutUI() : void
        {
            super.layoutUI();
            this.tabData = Language.getArray(80000);
            this.tabData.splice(1);
            this.tabBar = UIFactory.gTabBarNew(0, 32, this.tabData, 898, 598, 80, 26, this, this.onTabBarChange, "TabButtonNew");
            this.panelClassList.length = 0;
            this.panelClassList.push(LevelRewardVIPUpPanel);
            this.onTabBarChange();
            return;
        }// end function

        protected function onTabBarChange(event:Event = null) : void
        {
            if (this.tabBar.selectedIndex >= this.panelClassList.length)
            {
                return;
            }
            if (this.curPanel is this.panelClassList[this.tabBar.selectedIndex])
            {
                return;
            }
            if (this.curPanel)
            {
                this.curPanel.dispose(false);
            }
            this.currentIndex = this.tabBar.selectedIndex;
            this.curPanel = UICompomentPool.getUICompoment(this.panelClassList[this.tabBar.selectedIndex]);
            contentTopOf3DSprite.addChild(this.curPanel);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this.curPanel.dispose(param1);
            this.curPanel = null;
            return;
        }// end function

        override public function refresh(param1:Boolean = false) : void
        {
            super.refresh(param1);
            if (!allowRefresh)
            {
                return;
            }
            if (this.curPanel)
            {
                this.curPanel.refresh(param1);
            }
            return;
        }// end function

        public function get frameIndex() : int
        {
            return this.tabBar.selectedIndex;
        }// end function

        public function set frameIndex(param1:int) : void
        {
            this.tabBar.selectedIndex = param1;
            return;
        }// end function

    }
}
